/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Caps
 */
@Entity
@Table(name = "resposta")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Resposta.findAll", query = "SELECT r FROM Resposta r"),
    @NamedQuery(name = "Resposta.findByIdresposta", query = "SELECT r FROM Resposta r WHERE r.idresposta = :idresposta"),
    @NamedQuery(name = "Resposta.findByResposta", query = "SELECT r FROM Resposta r WHERE r.resposta = :resposta"),
    @NamedQuery(name = "Resposta.findByPtPos", query = "SELECT r FROM Resposta r WHERE r.ptPos = :ptPos"),
    @NamedQuery(name = "Resposta.findByPtNeg", query = "SELECT r FROM Resposta r WHERE r.ptNeg = :ptNeg"),
    @NamedQuery(name = "Resposta.findByData", query = "SELECT r FROM Resposta r WHERE r.data = :data")})
public class Resposta implements Serializable {
    @Column(name = "nota")
    private Integer nota;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idresposta")
    private Integer idresposta;
    @Size(max = 2147483647)
    @Column(name = "resposta")
    private String resposta;
    @Column(name = "pt_pos")
    private Integer ptPos;
    @Column(name = "pt_neg")
    private Integer ptNeg;
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @JoinColumns({
        @JoinColumn(name = "questionario_has_questao_questionario_idquestionario", referencedColumnName = "questionario_idquestionario"),
        @JoinColumn(name = "questionario_has_questao_questao_idquestao", referencedColumnName = "questao_idquestao")})
    @ManyToOne(optional = false)
    private QuestionarioHasQuestao questionarioHasQuestao;

    public Resposta() {
    }

    public Resposta(Integer idresposta) {
        this.idresposta = idresposta;
    }

    public Integer getIdresposta() {
        return idresposta;
    }

    public void setIdresposta(Integer idresposta) {
        this.idresposta = idresposta;
    }

    public String getResposta() {
        return resposta;
    }

    public void setResposta(String resposta) {
        this.resposta = resposta;
    }

    public Integer getPtPos() {
        return ptPos;
    }

    public void setPtPos(Integer ptPos) {
        this.ptPos = ptPos;
    }

    public Integer getPtNeg() {
        return ptNeg;
    }

    public void setPtNeg(Integer ptNeg) {
        this.ptNeg = ptNeg;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public QuestionarioHasQuestao getQuestionarioHasQuestao() {
        return questionarioHasQuestao;
    }

    public void setQuestionarioHasQuestao(QuestionarioHasQuestao questionarioHasQuestao) {
        this.questionarioHasQuestao = questionarioHasQuestao;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idresposta != null ? idresposta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Resposta)) {
            return false;
        }
        Resposta other = (Resposta) object;
        if ((this.idresposta == null && other.idresposta != null) || (this.idresposta != null && !this.idresposta.equals(other.idresposta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Resposta[ idresposta=" + idresposta + " ]";
    }

    public Integer getNota() {
        return nota;
    }

    public void setNota(Integer nota) {
        this.nota = nota;
    }
    
}
